let path = `C:/inetpub/wwwroot/出图/已传输完毕`
const Files = require('../utils/files');
var req = require("../utils/router");
let { router, GetRouter } = req

let files = new Files()
let fn = (path) => {
    let x = files.readdir(path, (err, data) => {
        console.log(data, "datadatadatadata")
    })
    console.log(x, "xxx")
}
new GetRouter().send('/name', function (res, data) {
    let name = data.name
    if (!name) {
        res.send({ code: 100, data: { url: "", msg: "不能为空" } });
        return
    }
    fn({
        path,
        success: (err, data) => {
            let url = data.reduce((current, item) => {
                if (item === `${name}.zip`) {
                    current = item
                }
                return current;
            }, "")
            if (url == "") {
                res.send({ code: 100, data: { url: "", msg: "没有该文件！" } });
            } else {
                res.send({ code: 200, data: { url: `http://162.14.80.40/download/${url}` } });
            }
        }
    })
})
module.exports = router;